import { showLoading, hideLoading } from '@/utils/loading.js'

export default {
  data() {
    return {
      // 全局loading状态
      globalLoading: false
    }
  },
  methods: {
    // 显示全局loading
    $showLoading(options = {}) {
      this.globalLoading = true
      showLoading(options)
    },
    // 隐藏全局loading
    $hideLoading() {
      this.globalLoading = false
      hideLoading()
    },
    // 带自动隐藏的loading
    $showLoadingWithAutoHide(options = {}, duration = 2000) {
      this.$showLoading(options)
      setTimeout(() => {
        this.$hideLoading()
      }, duration)
    }
  }
} 